using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class WeaponScrollTrigger : TriggerBase
{
    [SerializeField] private WeaponScrollDataListSO _weaponItemDataListSO;
    [SerializeField] private int _weaponSelectCount = 2;
    private List<WeaponScrollDataSO> _selectedWepaon = new();
    
    protected override void OnTriggerEnter2D(Collider2D other)
    {
        if (other.CompareTag("Player") == false)
            return;

        PlayerInventory playerInventory = other.GetComponent<PlayerInventory>();

        _selectedWepaon = playerInventory.GetCanSelectWeapon(_weaponItemDataListSO, _weaponSelectCount);

        if (_selectedWepaon.Count != 0)
            EventCenter.TriggerEvent(EventName.UI_OpenWeaponSelectPanel, _selectedWepaon);
        
        Destroy(gameObject);
    }
}
